#pragma once

#include "Pointer.hpp"

namespace HenkoCppLib
{
	class StringChar;

	class String
	{
		friend class StringChar;

	public:
		String();
		String(int size);
		String(const char* str);
		~String();

	public:
		int GetSize();
		int GetLength();

		Pointer<char> GetPointer();
		const char* GetNativePointer();

	public:
		StringChar operator[](int index);

	private:
		Pointer<char> str;

		const char* readonlystr;
		int readonlylength;
	};

	class StringChar
	{
	public:
		StringChar(StringChar& sc);
		StringChar(String& string, int index);

		bool IsReadOnly();
		char GetNativeChar();

		StringChar& operator=(char c);
		StringChar& operator=(StringChar c);
		operator char();

	private:
		int index;
		String str;
	};

}

std::ostream& operator<<(std::ostream& stream, HenkoCppLib::String& str);
std::ostream& operator<<(std::ostream& stream, HenkoCppLib::StringChar& str);

typedef HenkoCppLib::String S;
